/**
 * @projectName jiwuweixiu
 * @package com.zcx.project.service
 * @className com.zcx.project.service.Servcie
 * @copyright Copyright 2024 gy, Inc All rights reserved.
 */
package com.zcx.project.service;

import java.util.HashMap;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.zcx.project.entity.ZcxProblem;
import com.zcx.project.entity.ZcxTrainInfo;
import com.zcx.project.mapper.ZcxProblemMapper;
import com.zcx.project.mapper.ZcxTrainInfoMapper;

/**
 * Servcie
 *
 * @author gy
 * @version v1.0.0
 * @description
 * @date 2024/4/18 17:21
 */
@Service
public class ZcxProblemServcie {

    @Autowired
    ZcxProblemMapper zcxProblemMapper;
    @Autowired
    ZcxTrainInfoMapper zcxTrainInfoMapper;


    public Map<String, Object> addZcxProblem(ZcxProblem obj) {
        int i = zcxProblemMapper.insertSelective(obj);
        Map<String, Object> returnMap = new HashMap<String, Object>();
        if (i == 0)
            returnMap.put("showInfo", "添加失败！");
        else {
            ZcxTrainInfo zt = new ZcxTrainInfo();
            zt.setId(obj.getTrainInfoId());
            zt.setStatus("维修中");
            zcxTrainInfoMapper.updateByPrimaryKeySelective(zt);

            returnMap.put("showInfo", "添加成功！");
        }
        return returnMap;
    }
}